//
//  UIBarButtonItem+Extension.swift
//  MLWeiBo
//
//  Created by wenxing on 2017/1/4.
//  Copyright © 2017年 Se7venX. All rights reserved.
//

import UIKit

extension UIBarButtonItem {

    convenience init(title:String = "",imageName:String = "",tatget:Any?,selector:Selector) {
        self.init()
        
        let btn = UIButton()
    
        btn.setImage(UIImage(named: imageName), for: .normal)
        btn.setImage(UIImage(named: imageName+"_highlighted"), for: .highlighted)
        
        btn.setTitleColor(#colorLiteral(red: 0.1294117719, green: 0.2156862766, blue: 0.06666667014, alpha: 1), for: .normal)
        btn.setTitle(title, for: .normal)
        
        btn.addTarget(tatget, action: selector, for: .touchUpInside)
        
        btn.sizeToFit()
        
      self.customView = btn
        
    }
}


